/**
 * Created by zzy on 2017/8/25.
 */
import React, {Component} from 'react';
import {
    Text,
    View,
    TouchableOpacity,
    Image,
    StyleSheet,
    Dimensions
} from 'react-native';
import NavigationBar from 'react-native-navbar'
import Constant from '../Contant'
import Icon from 'react-native-vector-icons/Ionicons'
let {width, height} = Dimensions.get('window');


class LeftArrow extends Component{
    render(){
        const {goBack} = this.props.navigation;
        return <TouchableOpacity
            onPress={()=>{
                goBack();
            }}
            style={{alignItems:'center',padding:12}}>
            <Icon name="ios-arrow-back" color="gray" size={28}/>
        </TouchableOpacity>
    }
}


export default class HBNavgator extends Component{

    render(){
        let {title,leftButton,rightButton,hiddenArrow,navigation} = this.props;
        if(leftButton==null &&!hiddenArrow){
            leftButton = <LeftArrow navigation={navigation}/>
        }
        return <View style={styles.container}>
            <NavigationBar
                leftButton={leftButton}
                rightButton={rightButton}
                title={{title: title, tintColor: Constant.TEXTCONTENTCOLOR}}
                tintColor={Constant.NAVCOLOR}/>
        </View>
    }
}


const styles = {
    container:{
        borderBottomWidth:StyleSheet.hairlineWidth,
        borderBottomColor:Constant.SEPLINECOLOR,
        borderTopWidth:StyleSheet.hairlineWidth,
        borderTopColor:Constant.SEPLINECOLOR,
        shadowColor:'red',
        shadowRadius:10
    }
}
